package cn.linjianhui.flink.sample.model;

import org.apache.commons.compress.utils.Sets;

import java.math.BigDecimal;
import java.util.Set;

public class AreaAccumulator {
    private String provinceCode;
    private String province;
    private BigDecimal payAmount;
    private Set<String> orderIds;

    public AreaAccumulator() {
        payAmount = BigDecimal.ZERO;
        orderIds = Sets.newHashSet();
    }

    public String getProvinceCode() {
        return provinceCode;
    }

    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public BigDecimal getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(BigDecimal payAmount) {
        this.payAmount = payAmount;
    }

    public Set<String> getOrderIds() {
        return orderIds;
    }

    public void setOrderIds(Set<String> orderIds) {
        this.orderIds = orderIds;
    }

    public void addPayAmount(BigDecimal payAmount) {
        this.payAmount = this.payAmount.add(payAmount);
    }

    public boolean addOrderId(String orderId) {
        return orderIds.add(orderId);
    }

    public boolean addOrderIds(Set<String> orderIds) {
        return orderIds.addAll(orderIds);
    }

    public boolean containsOrder(String orderId) {
        return this.orderIds.contains(orderId);
    }
}
